Fix computation of alpha channel for transparent objects#110
Merged
ManifoldFR merged 2 commits intoSimple-Robotics:mainfrom Feb 26, 2026
Merged
Fix computation of alpha channel for transparent objects#110ManifoldFR merged 2 commits intoSimple-Robotics:mainfrom
ManifoldFR merged 2 commits intoSimple-Robotics:mainfrom
Conversation
…in fragment shader + weight applies to accum.a, not to revealage (account for change in blend formula)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix WBOIT transparency so that transparent objects over a transparent background have correct alpha in PNG output, and improve color reconstruction in the composite pass.
Wrong revealage:
output.reveal = 1.0 - alpha * weightproduces negative values for most materials (whenalpha * weight > 1), which clamp to 0 in theR8_UNORMtexture format. The multiplicative blend then leaves the revealTexture unchanged at its clear value of 1.0, so the composite always computesalpha = 1 - reveal = 0. Fixed tooutput.reveal = alpha.Wrong accumulation denominator: accum.a = alpha caused the composite to reconstruct color * weight instead of color. Fixed to
accum.a = alpha * weight.Before (click the picture; on browsers which support transparency in PNG the robot body will be blank (black))


After (robot body is properly transparent)
There were already changes to WBOIT in #109 but they weren't enough.
@pierfabre